from flask import Blueprint, request
from ..controllers.event import create_event, get_events, get_event, update_event, delete_event

# 创建活动管理蓝图
event_bp = Blueprint("events", __name__, url_prefix="/events")

# 活动管理路由
# 创建活动
@event_bp.route("/add", methods=["POST"])
def route_create_event():
    data = request.get_json() or {}
    return create_event(data)

# 获取活动列表
@event_bp.route("/list", methods=["GET"])
def route_get_events():
    data = request.args.to_dict() or {}
    return get_events(data)

# 获取单个活动信息
@event_bp.route("/event", methods=["GET"])
def route_get_event():
    data = request.args.to_dict() or {}
    return get_event(data)

# 更新活动信息
@event_bp.route("/edit", methods=["POST"])
def route_update_event():
    data = request.get_json() or {}
    return update_event(data)
# 删除活动
@event_bp.route("/delete", methods=["POST"])
def route_delete_event():
    data = request.get_json() or {}
    return delete_event(data)
